module.exports = function ($scope, $state, $modalInstance, $resource, $modal, toaster,bean) {
  // var bean = bean;
  console.log(bean);
  $scope.bean = {
    'postflag' : ''
  }
  angular.extend($scope.bean, bean);
  console.log($scope.bean);
  // console.log($scope.bean.postflag);

  $scope.loadlist = function () {
    $resource('/api/ac/ggc/voluntourismAccountService/findIdsList', {}, {}).save($scope.bean, function (res) {
      console.log(res);

      if (res.errcode == 0) {
        $scope.imgarr = res.data.result;
      }
      
    });
  }

  $scope.loadlist();

  $scope.add = function (bean) {
    console.log(bean);
    $scope.bean.postflag = '1';
    var modalInstance = $modal.open({
			template: require('../views/tourPoster.html'),
			controller: 'tourPoster',
			size: 'lg',
			resolve: {
				bean: function () {
					return $scope.bean;
				}
			}
		});
		//关闭模态框刷新页面
		modalInstance.result.then(function () {
      $scope.loadlist();
		});
  }

  $scope.bianji = function (ids) {
    $scope.bean.poster_ids = ids;
    $scope.bean.postflag = '2';
    var modalInstance = $modal.open({
			template: require('../views/tourPoster.html'),
			controller: 'tourPoster',
			size: 'lg',
			resolve: {
				bean: function () {
					return $scope.bean;
				}
			}
		});
		//关闭模态框刷新页面
		modalInstance.result.then(function () {
      $scope.loadlist();
		});
  }


  $scope.cancel = function () {
    $modalInstance.close();
}

};